/**
 * 商品与商品分类的接口调用
 * */

// 引入axios封装
import request from "@/utils/request"

// 调用后台获取商品分类列表数据
export const getGoodsCategory = (params) => {
    return request({
        url: "/category/getGoodsCategory",
        method: "get",
        params,
    })
}
// 调用后台获取商品分类列表数据
export const getAllCategory = (params) => {
    return request({
        url: "/category/getAllCategory",
        method: "get",
        params,
    })
}
 
// 根据商品分类的id删除商品分类
export const deleteGoodsCategoryById = (data) => { 
    return request({
        url: "/category/deleteGoodsCategoryById",
        method: "post",
        data
    })
}

// 添加商品分类
export const addGoodsCategory = (data) => { 
    return request({
        url: "/category/addGoodsCategory",
        method: "post",
        data
    })
}

// 加载一级分类数据
export const getSuperCategory = (params) => { 
    return request({
        url: "/category/getSuperCategory",
        method: "get",
        params
    })
}

/**
 * 商品数据查询
 */
export const getGoods = (currentPage,pageSize,data) => { 
    return request({
        url: `/goods/getGoods/${currentPage}/${pageSize}`,
        method: "post",
        data
    })
}


/**
 * 删除商品
 */ 
export const deleteGoodsById = (id) => { 
    return request({
        url: `/goods/${id}`,
        method: "delete",
    })
}

/**
 * 添加商品
 */ 
export const addGoods = (data) => { 
    return request({
        url: "/goods/addGoods",
        method: "post",
        data
    })
}

/**
 * 修改商品信息
 */ 
export const updateGoods = (data) => { 
    return request({
        url: "/goods/updateGoods",
        method: "post",
        data
    })
}

/**
 * 根据商品的名称查询商品数据
 */
export const getAllGoods = (params) => {
    return request({
        url: "/goods/getAllGoods",
        method: "get",
        params
    })
}